﻿@model DauGiaApp.Models.SanPham
@{
    ViewBag.Title = "DangSanPham";
}
<h2>Đăng sản phẩm</h2>
<script type="text/javascript" src="../../Scripts/jquery-1.6.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-ui-1.8.11.js"></script>

<link rel="stylesheet" type="text/css" href="../../Scripts/D4Scripts/cleditor/jquery.cleditor.css" />
<script type="text/javascript" src="../../Scripts/D4Scripts/cleditor/jquery.cleditor.js"></script>

<link rel="stylesheet" type="text/css" href="../../Content/datetimepicker/jquery.ui.datetimepicker.css" />
<link rel="stylesheet" type="text/css" href="../../Content/jquery-css/jquery-ui-1.8.13.custom.css" />
<script type="text/javascript" src="../../Scripts/datetimepicker/jquery.ui.datetimepicker.js"></script>

<script type="text/javascript" src="../../Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.validate.unobtrusive.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $("#MoTaSanPham").cleditor();
        $('#dtpicker').datetimepicker();
    });
</script>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>SanPham</legend>
        <table width="100%">
            <tr>
                <td>
                    Tên sản phẩm
                </td>
                <td>
                    @Html.EditorFor(model => model.TenSanPham)
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.TenSanPham)
                </td>
            </tr>
            <tr>
                <td>
                    Loại sản phẩm
                </td>
                <td>
                    @Html.DropDownList("MaLoaiSanPham")
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.MaLoaiSanPham)
                </td>
            </tr>
            <tr>
                <td>
                    Thời gian bắt đầu đấu giá
                </td>
                <td>
                    <input type="text" name="NgayHetHan" id="dtpicker"/>
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.NgayHetHan)
                </td>
            </tr>
            <tr>
                <td>
                    Giá khởi điểm
                </td>
                <td>
                    @Html.EditorFor(model => model.GiaKhoiDiem)
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.GiaKhoiDiem)
                </td>
            </tr>
            <tr>
                <td>
                    Giá thị trường
                </td>
                <td>
                    @Html.EditorFor(model => model.GiaThiTruong)
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.GiaThiTruong)
                </td>
            </tr>
            <tr>
                <td>
                    Chọn ảnh đại điện
                </td>
                <td>
                    <div id="file-uploader-demo1">
                        <noscript>
                            <p>
                                Please enable JavaScript to use file uploader.</p>
                            <!-- or put a simple form for upload here -->
                        </noscript>
                    </div>
                </td>
                <td>
                    @Html.ValidationMessageFor(model => model.MaAnhDaiDien)
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    Mô tả sản phẩm
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <textarea rows="1" cols="1" id="MoTaSanPham" name="MoTaSanPham"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <input type="submit" value="Đăng Sản Phẩm" />
                </td>
            </tr>
        </table>
    </fieldset>
    
    
}
<link href="../../Scripts/D4Scripts/upload/fileuploader.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../Scripts/D4Scripts/upload/fileuploader.js"></script>
<script type="text/javascript">
    
    function createUploader() {
        var uploader = new qq.FileUploader({
            element: document.getElementById('file-uploader-demo1'),
            action: 'FileUpload',
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
            sizeLimit: 2147483647, // max size
            multiple: false,
            onComplete: function(id, fileName, responseJSON){            
            },
        });
        
    }
    
    // in your app create uploader as soon as the DOM is ready
    // don't wait for the window to load  
    window.onload = createUploader;     
</script>
